#include <iostream>
#include <Windows.h>

using namespace std;

int main()
{

    cout << "hello world" << endl;

    HANDLE hFile = CreateFile(L"test.txt", GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);

    if (hFile == INVALID_HANDLE_VALUE) {
        std::cerr << "CreateFile failed. Error: " << GetLastError() << std::endl;
        return 1;
    }

    DWORD bytesWritten;
    char data[] = "Hello, World!";
    WriteFile(hFile, data, sizeof(data), &bytesWritten, NULL);

    if (!FlushFileBuffers(hFile)) {
        std::cerr << "FlushFileBuffers failed. Error: " << GetLastError() << std::endl;
        CloseHandle(hFile);
        return 1;
    }

    CloseHandle(hFile);


    return 0;
}
